package com.itshizhan.demo01.config;

import com.itshizhan.demo01.result.result.Result;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author itshizhan
 * @email 370424110@qq.com
 * @date 2021-08-06
 */

@RestControllerAdvice
public class GlobalException  {

    @ExceptionHandler(value = RuntimeException.class)
    public Result<Object> handler(RuntimeException e) {
        return Result.fail(e.getMessage());
    }

}
